<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Return TRUE if the given function has been defined</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.func-num-args.html">func_num_args</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.get-defined-functions.html">get_defined_functions</a></div>
 <div class="up"><a href="ref.funchand.html">Function handling 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.function-exists" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">function_exists</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">function_exists</span> &mdash; <span class="dc-title">Return <strong><code>TRUE</code></strong> if the given function has been defined</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.function-exists-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>function_exists</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$function_name</code></span>
   )</div>

  <p class="para rdfs-comment">
   Checks the list of defined functions, both built-in (internal) and
   user-defined, for <em><code class="parameter">function_name</code></em>. 
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.function-exists-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">function_name</code></em></dt>

     <dd>

      <p class="para">
       The function name, as a string.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.function-exists-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> if <em><code class="parameter">function_name</code></em> exists and is a
   function, <strong><code>FALSE</code></strong> otherwise.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    This function will return <strong><code>FALSE</code></strong> for constructs, such as 
    <span class="function"><a href="function.include-once.html" class="function">include_once</a></span> and <span class="function"><a href="function.echo.html" class="function">echo</a></span>.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 examples" id="refsect1-function.function-exists-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5019">
    <p><strong>Example #1 <span class="function"><strong>function_exists()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">function_exists</span><span style="color: #007700">(</span><span style="color: #DD0000">'imap_open'</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"IMAP&nbsp;functions&nbsp;are&nbsp;available.&lt;br&nbsp;/&gt;\n"</span><span style="color: #007700">;<br />}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"IMAP&nbsp;functions&nbsp;are&nbsp;not&nbsp;available.&lt;br&nbsp;/&gt;\n"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.function-exists-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    A function name may exist even if the function itself is unusable due to
    configuration or compiling options (with the <a href="ref.image.html" class="link">image</a> functions being an example).
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.function-exists-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.method-exists.html" class="function" rel="rdfs-seeAlso">method_exists()</a> - 检查类的方法是否存在</span></li>
    <li class="member"><span class="function"><a href="function.is-callable.html" class="function" rel="rdfs-seeAlso">is_callable()</a> - 检测参数是否为合法的可调用结构</span></li>
    <li class="member"><span class="function"><a href="function.get-defined-functions.html" class="function" rel="rdfs-seeAlso">get_defined_functions()</a> - Returns an array of all defined functions</span></li>
    <li class="member"><span class="function"><a href="function.class-exists.html" class="function" rel="rdfs-seeAlso">class_exists()</a> - 检查类是否已定义</span></li>
    <li class="member"><span class="function"><a href="function.extension-loaded.html" class="function" rel="rdfs-seeAlso">extension_loaded()</a> - 检查一个扩展是否已经加载</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.func-num-args.html">func_num_args</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.get-defined-functions.html">get_defined_functions</a></div>
 <div class="up"><a href="ref.funchand.html">Function handling 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
